home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 3 / BBS in a box - Trilogy III.iso / Files / Prog / S / Scientist's Spreadsheet / Procedures / Ternary Diagram < prev    next >
Encoding:
Text File  |  1987-02-26  |  1.5 KB  |  61 lines  |  [TEXT/TEXT]

  1. ''    'Ternary Diagram Procedures for Scientists Spreadsheet V2.17'
  2. ''    'a set of procedures to plot ternary diagrams'
  3. ''    'the table must be at least 5 columns wide'
  4. ''    'with the fractions of end members A, B, C, in columns 1, 2, 3'
  5. ''  'actually, you dont need to put data in 3, it is computed as 1-A-B'
  6. ''    'columns 4 and 5 are used, so dont put data in them'
  7. ''    'plot-triange draws the triangle on the graphics screen'
  8. ''  'with the vertices labeled with the column names'
  9. ''    'plot-ternary recomputes C and plots the data'
  10. ''    'pick activated the cursor and prints out A,B,C values'
  11. ''  'pick is an endless loop, so it must be aborted from the abort menu'
  12.  
  13. label plot-triangle
  14. vector .5 .866 0 0
  15. vector 0 0 1 0
  16. vector 1 0 .5 .866
  17. set x colname 2
  18. anotate -0.04 -0.04 @x
  19. set x colname 3
  20. anotate 1.04 -0.04 @x
  21. set x colname 1
  22. anotate 0.49 0.906 @x
  23. delete variable x
  24. return
  25.  
  26. label  plot-ternary
  27.     '' 'optional first argument is plotting symbol (default is stars)'
  28.     if @arg1 s= ''
  29.         setvar arg1 stars
  30.     xaxis 0 1.28
  31.     yaxis 0.1 0.9
  32.     constant 1 3
  33.     cmath 3 - 2 = 3
  34.     cmath 3 - 1 = 3
  35.     cmath 1 /# 2 = 4
  36.     cmath 3 + 4 = 4
  37.     cmath 1 *# 0.866 = 5
  38.     plot 4 5 @arg1
  39.     return
  40.  
  41. label pick
  42.     prompt 'use the abort menu to terminate this routine'
  43.   set an colname 1
  44.   set bn colname 2
  45.   set cn colname 3
  46.     for i 1 100
  47.     cursor 'pick a point'
  48.     vmath @ypos / 0.866 = a
  49.     vmath @a / 2 = ao2
  50.     vmath  @xpos - @ao2 = c
  51.     vmath  @a + @c = b
  52.     vmath  1 - @b = b
  53.     prompt @an ' = ' @a
  54.     prompt @bn ' = ' @b
  55.     prompt @cn ' = ' @c
  56.     next i
  57.     return
  58.  
  59.  
  60.  
  61.